<?php

class QRoute
{
    private $xmlObject;
    private $routeName;
    private $routePath;
    private $QXC;

    /* Constructor */
    function __construct($qxc)
    {
        $this->QXC = $qxc;
    }

    public function Open($name)
    {
        $this->routeName = $name;
        $this->routePath = CONFIG_DIR . '/' . strtolower($this->routeName) . "." . CORE_XML_EXT;

        $this->xmlObject = $this->QXC->Xml->Open($this->routePath)->ToObject(null, false);

        return $this;
    }

    public function Get($name, $default = false)
    {
        return $name && $this->xmlObject->{$name} ? $this->xmlObject->{$name} : $default;
    }

    function __get($name)
    {
        return $this->xmlObject->{$name};
    }
}